<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			p span{
				margin: 50px;
			}
		</style>
	</head>
	<body>
		<script type="text/javascript">
		/*给一个数组赋10个100以内的随机值*/
			function randomArray(a){
				for(var i=0;i<10 ;i++){
					a[i]=parseInt(Math.random()*100)
				}
			}
			function outArray(a){
				var p=document.createElement("p");
				a.forEach(function(val,index){
					var span=document.createElement("span");
					if(index%2==0){
						span.style.color="red";
					}
					else span.style.color="brown"
					span.innerHTML=val;
					p.appendChild(span);
				});
				document.body.appendChild(p);
			}
			var a=[];randomArray(a);outArray(a);
			randomArray(a);
			outArray(a);
			a=a.reverse();
			outArray(a);
			a=a.sort(function(a,b){
				return b-a;
			});
			outArray(a);
			
			var str=a.join(",");
			var p=document.createElement("p");
			p.innerText=str;
			p.style.fontFamily="华文彩云";
			p.style.fontColor="red";
			p.style.fontSize="34px";
			document.body.appendChild(p);
			
			var str1=a.toString();
			var p1=document.createElement("p");
			p1.innerText=str1;
			document.body.appendChild(p1);
		</script>
	</body>
</html>
